package com.anbang.app.ui.frame.activity

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import com.anbang.app.base.activity.BaseActivity

class SplashActivity : BaseActivity() {

    private val delayTime: Long = 1000

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //setContentView(R.layout.activity_splash)
        //隐藏系统状态栏
        //  window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
        //window.decorView.findViewById<ViewGroup>(Window.ID_ANDROID_CONTENT).getChildAt(0).fitsSystemWindows = false

        Handler().postDelayed({
            var intent = Intent(this@SplashActivity, MainActivity::class.java)
            startActivity(intent)
            finish()
            //修改Activity切换动画(这里使用的是Android SDK中动画)
            //第一个参数为Activity进入时的动画，第二参数为Activity离开时的动画效果
            //此方法在startActivity()或者是finish()后调用，在切换或是退出时就会调用此动画
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
        }, delayTime)
    }
}
